<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.0.0">
  <link rel="apple-touch-icon" sizes="180x180" href="/hexo/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/hexo/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/hexo/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/hexo/images/logo.svg" color="#222">

<link rel="stylesheet" href="/hexo/css/main.css">


<link rel="stylesheet" href="/hexo/lib/font-awesome/css/all.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"hf98.gitee.io","root":"/hexo/","scheme":"Pisces","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":false,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}}};
  </script>

  <meta name="description" content="hexo:一个基于nodex.js的静态页面博客，可通过安装插件实现登录、评论等功能，搭建简易，可直接挂载于gitee&#x2F;github hexo常用命令 hexo clean ：清除缓存 hexo generate ：生成相关静态页面 hexo server ：开启hexo本地服务 hexo deploy ：发布本地变更到远端服务器  安装流程 物理机安装方式   安装gitwindows: 官网下">
<meta property="og:type" content="article">
<meta property="og:title" content="hexo博客搭建">
<meta property="og:url" content="http://hf98.gitee.io/hexo/2020/08/08/%E6%97%A5%E5%B8%B8/hexo%E5%8D%9A%E5%AE%A2%E6%90%AD%E5%BB%BA/">
<meta property="og:site_name" content="梁汉烽的博客">
<meta property="og:description" content="hexo:一个基于nodex.js的静态页面博客，可通过安装插件实现登录、评论等功能，搭建简易，可直接挂载于gitee&#x2F;github hexo常用命令 hexo clean ：清除缓存 hexo generate ：生成相关静态页面 hexo server ：开启hexo本地服务 hexo deploy ：发布本地变更到远端服务器  安装流程 物理机安装方式   安装gitwindows: 官网下">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2020-08-08T02:12:49.000Z">
<meta property="article:modified_time" content="2020-08-10T05:58:57.521Z">
<meta property="article:author" content="Liang HF">
<meta property="article:tag" content="学习日常">
<meta property="article:tag" content="博客">
<meta name="twitter:card" content="summary">

<link rel="canonical" href="http://hf98.gitee.io/hexo/2020/08/08/%E6%97%A5%E5%B8%B8/hexo%E5%8D%9A%E5%AE%A2%E6%90%AD%E5%BB%BA/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>

  <title>hexo博客搭建 | 梁汉烽的博客</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/hexo/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">梁汉烽的博客</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
      <p class="site-subtitle" itemprop="description">日常学习总结</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="main-menu menu">
        <li class="menu-item menu-item-home">

    <a href="/hexo/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/hexo/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/hexo/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/hexo/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a>

  </li>
  </ul>
</nav>




</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://hf98.gitee.io/hexo/2020/08/08/%E6%97%A5%E5%B8%B8/hexo%E5%8D%9A%E5%AE%A2%E6%90%AD%E5%BB%BA/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/hexo/images/avatar.gif">
      <meta itemprop="name" content="Liang HF">
      <meta itemprop="description" content="普通人">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="梁汉烽的博客">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          hexo博客搭建
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2020-08-08 10:12:49" itemprop="dateCreated datePublished" datetime="2020-08-08T10:12:49+08:00">2020-08-08</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2020-08-10 13:58:57" itemprop="dateModified" datetime="2020-08-10T13:58:57+08:00">2020-08-10</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/hexo/categories/hexo/" itemprop="url" rel="index"><span itemprop="name">hexo</span></a>
                </span>
            </span>

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <p>hexo:一个基于nodex.js的静态页面博客，可通过安装插件实现登录、评论等功能，搭建简易，可直接挂载于gitee/github</p>
<h3 id="hexo常用命令"><a href="#hexo常用命令" class="headerlink" title="hexo常用命令"></a>hexo常用命令</h3><ul>
<li>hexo clean ：清除缓存</li>
<li>hexo generate ：生成相关静态页面</li>
<li>hexo server ：开启hexo本地服务</li>
<li>hexo deploy ：发布本地变更到远端服务器</li>
</ul>
<h3 id="安装流程"><a href="#安装流程" class="headerlink" title="安装流程"></a>安装流程</h3><ul>
<li><h4 id="物理机安装方式"><a href="#物理机安装方式" class="headerlink" title="物理机安装方式"></a>物理机安装方式</h4></li>
</ul>
<ol>
<li><h5 id="安装git"><a href="#安装git" class="headerlink" title="安装git"></a>安装git</h5><p>windows: 官网下载安装</p>
<p>linux(ubuntu): </p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo apt-get install git</span><br></pre></td></tr></table></figure>

<p><code>git --version</code>查看是否安装成功</p>
</li>
<li><h5 id="安装node-js"><a href="#安装node-js" class="headerlink" title="安装node.js"></a>安装node.js</h5><p>windows:选择稳定版本安装</p>
<p>linux:</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">sudo apt-get install nodejs</span><br><span class="line">sudo apt-get install npm</span><br></pre></td></tr></table></figure>

<p><code>node -v</code> 和 <code>npm -v</code> 验证是否安装成功</p>
</li>
<li><h5 id="安装hexo"><a href="#安装hexo" class="headerlink" title="安装hexo"></a>安装hexo</h5><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install -g hexo-cli</span><br></pre></td></tr></table></figure>

<p><code>hexo -v</code>查看版本是否安装成功</p>
</li>
<li><h5 id="创建项目"><a href="#创建项目" class="headerlink" title="创建项目"></a>创建项目</h5><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">hexo init [博客项目名称]</span><br><span class="line">cd [项目目录文件夹]</span><br><span class="line">npm install //处理相关依赖</span><br></pre></td></tr></table></figure>

<p>新建完成后，指定文件夹目录下有：</p>
<ul>
<li>node_modules: 依赖包</li>
<li>public：存放生成的页面</li>
<li>scaffolds：生成文章的一些模板</li>
<li>source：用来存放你的文章</li>
<li>themes：主题</li>
<li>** _config.yml: 博客的配置文件**</li>
</ul>
</li>
<li><h5 id="远端代码库创建同步项目-github-gitee"><a href="#远端代码库创建同步项目-github-gitee" class="headerlink" title="远端代码库创建同步项目(github/gitee)"></a>远端代码库创建同步项目(github/gitee)</h5><ul>
<li><h6 id="github"><a href="#github" class="headerlink" title="github:"></a>github:</h6><ol>
<li><p>创建个人仓库</p>
</li>
<li><p>绑定git个人仓库，添加ssh公钥到github</p>
</li>
<li><p>修改hexo项目 <code>_config.yml</code>文件配置</p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">deploy:</span></span><br><span class="line">  <span class="attr">type:</span> <span class="string">git</span></span><br><span class="line">  <span class="attr">repo:</span> <span class="string">&lt;repository</span> <span class="string">url&gt;</span></span><br><span class="line">  <span class="attr">branch:</span> [<span class="string">branch</span>]</span><br></pre></td></tr></table></figure>
</li>
<li><p>部署github_page 生成相关链接/绑定域名（可选）</p>
</li>
</ol>
</li>
<li><h6 id="gitee"><a href="#gitee" class="headerlink" title="gitee"></a>gitee</h6><ol>
<li>大致与github相同，只有绑定相关页面不同</li>
</ol>
</li>
</ul>
</li>
</ol>
<ol start="6">
<li><h5 id="写文章-安装扩展插件-同步博客文章"><a href="#写文章-安装扩展插件-同步博客文章" class="headerlink" title="写文章/安装扩展插件/同步博客文章"></a>写文章/安装扩展插件/同步博客文章</h5><ol>
<li><h6 id="hexo基础配置"><a href="#hexo基础配置" class="headerlink" title="hexo基础配置"></a>hexo基础配置</h6></li>
</ol>
<table>
<thead>
<tr>
<th><code>title</code></th>
<th align="center">网站标题</th>
</tr>
</thead>
<tbody><tr>
<td><code>subtitle</code></td>
<td align="center">网站副标题</td>
</tr>
<tr>
<td><code>description</code></td>
<td align="center">网站描述</td>
</tr>
<tr>
<td><code>author</code></td>
<td align="center">您的名字</td>
</tr>
<tr>
<td><code>language</code></td>
<td align="center">网站使用的语言</td>
</tr>
<tr>
<td><code>timezone</code></td>
<td align="center">网站时区。Hexo 默认使用您电脑的时区。<a href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones">时区列表</a>。比如说：<code>America/New_York</code>, <code>Japan</code>, 和 <code>UTC</code> 。</td>
</tr>
</tbody></table>
<h6 id="2-文章基础配置（md-formatter）"><a href="#2-文章基础配置（md-formatter）" class="headerlink" title="2.文章基础配置（md formatter）"></a>2.文章基础配置（md formatter）</h6><table>
<thead>
<tr>
<th>参数</th>
<th align="center">描述</th>
</tr>
</thead>
<tbody><tr>
<td><code>layout</code></td>
<td align="center">布局</td>
</tr>
<tr>
<td><code>title</code></td>
<td align="center">标题</td>
</tr>
<tr>
<td><code>date</code></td>
<td align="center">建立日期</td>
</tr>
<tr>
<td><code>updated</code></td>
<td align="center">更新日期</td>
</tr>
<tr>
<td><code>comments</code></td>
<td align="center">开启文章的评论功能</td>
</tr>
<tr>
<td><code>tags</code></td>
<td align="center">标签（不适用于分页）</td>
</tr>
<tr>
<td><code>categories</code></td>
<td align="center">分类（不适用于分页）</td>
</tr>
<tr>
<td><code>permalink</code></td>
<td align="center">覆盖文章网址</td>
</tr>
</tbody></table>
</li>
</ol>
<ul>
<li><h4 id="虚拟环境（docker）"><a href="#虚拟环境（docker）" class="headerlink" title="虚拟环境（docker）"></a>虚拟环境（docker）</h4></li>
</ul>
<ol>
<li>基于node基础容器/linux基础容器上安装node、hexo，构建初始化项目映像</li>
<li>根据个人需要映射物理环境的样式、文章到容器的具体相关文件夹中</li>
<li>构建博客项目容器</li>
</ol>
<blockquote>
<p>PS：参考链接 ：<a href="https://blog.csdn.net/sinat_37781304/article/details/82729029">https://blog.csdn.net/sinat_37781304/article/details/82729029</a></p>
</blockquote>

    </div>

    
    
    

      <footer class="post-footer">
          <div class="post-tags">
              <a href="/hexo/tags/%E5%AD%A6%E4%B9%A0%E6%97%A5%E5%B8%B8/" rel="tag"># 学习日常</a>
              <a href="/hexo/tags/%E5%8D%9A%E5%AE%A2/" rel="tag"># 博客</a>
          </div>

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/hexo/2020/07/17/np/isis/ISIS/" rel="prev" title="ISIS">
      <i class="fa fa-chevron-left"></i> ISIS
    </a></div>
      <div class="post-nav-item"></div>
    </div>
      </footer>
    
  </article>
  
  
  



          </div>
          

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#hexo%E5%B8%B8%E7%94%A8%E5%91%BD%E4%BB%A4"><span class="nav-number">1.</span> <span class="nav-text">hexo常用命令</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%AE%89%E8%A3%85%E6%B5%81%E7%A8%8B"><span class="nav-number">2.</span> <span class="nav-text">安装流程</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#%E7%89%A9%E7%90%86%E6%9C%BA%E5%AE%89%E8%A3%85%E6%96%B9%E5%BC%8F"><span class="nav-number">2.1.</span> <span class="nav-text">物理机安装方式</span></a><ol class="nav-child"><li class="nav-item nav-level-5"><a class="nav-link" href="#%E5%AE%89%E8%A3%85git"><span class="nav-number">2.1.1.</span> <span class="nav-text">安装git</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#%E5%AE%89%E8%A3%85node-js"><span class="nav-number">2.1.2.</span> <span class="nav-text">安装node.js</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#%E5%AE%89%E8%A3%85hexo"><span class="nav-number">2.1.3.</span> <span class="nav-text">安装hexo</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#%E5%88%9B%E5%BB%BA%E9%A1%B9%E7%9B%AE"><span class="nav-number">2.1.4.</span> <span class="nav-text">创建项目</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#%E8%BF%9C%E7%AB%AF%E4%BB%A3%E7%A0%81%E5%BA%93%E5%88%9B%E5%BB%BA%E5%90%8C%E6%AD%A5%E9%A1%B9%E7%9B%AE-github-gitee"><span class="nav-number">2.1.5.</span> <span class="nav-text">远端代码库创建同步项目(github&#x2F;gitee)</span></a><ol class="nav-child"><li class="nav-item nav-level-6"><a class="nav-link" href="#github"><span class="nav-number">2.1.5.1.</span> <span class="nav-text">github:</span></a></li><li class="nav-item nav-level-6"><a class="nav-link" href="#gitee"><span class="nav-number">2.1.5.2.</span> <span class="nav-text">gitee</span></a></li></ol></li><li class="nav-item nav-level-5"><a class="nav-link" href="#%E5%86%99%E6%96%87%E7%AB%A0-%E5%AE%89%E8%A3%85%E6%89%A9%E5%B1%95%E6%8F%92%E4%BB%B6-%E5%90%8C%E6%AD%A5%E5%8D%9A%E5%AE%A2%E6%96%87%E7%AB%A0"><span class="nav-number">2.1.6.</span> <span class="nav-text">写文章&#x2F;安装扩展插件&#x2F;同步博客文章</span></a><ol class="nav-child"><li class="nav-item nav-level-6"><a class="nav-link" href="#hexo%E5%9F%BA%E7%A1%80%E9%85%8D%E7%BD%AE"><span class="nav-number">2.1.6.1.</span> <span class="nav-text">hexo基础配置</span></a></li><li class="nav-item nav-level-6"><a class="nav-link" href="#2-%E6%96%87%E7%AB%A0%E5%9F%BA%E7%A1%80%E9%85%8D%E7%BD%AE%EF%BC%88md-formatter%EF%BC%89"><span class="nav-number">2.1.6.2.</span> <span class="nav-text">2.文章基础配置（md formatter）</span></a></li></ol></li></ol></li><li class="nav-item nav-level-4"><a class="nav-link" href="#%E8%99%9A%E6%8B%9F%E7%8E%AF%E5%A2%83%EF%BC%88docker%EF%BC%89"><span class="nav-number">2.2.</span> <span class="nav-text">虚拟环境（docker）</span></a></li></ol></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
  <p class="site-author-name" itemprop="name">Liang HF</p>
  <div class="site-description" itemprop="description">普通人</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/hexo/archives/">
        
          <span class="site-state-item-count">15</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/hexo/categories/">
          
        <span class="site-state-item-count">2</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/hexo/tags/">
          
        <span class="site-state-item-count">15</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>



      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2020</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Liang HF</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://pisces.theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Pisces</a> 强力驱动
  </div>

        








      </div>
    </footer>
  </div>

  
  <script src="/hexo/lib/anime.min.js"></script>
  <script src="/hexo/lib/velocity/velocity.min.js"></script>
  <script src="/hexo/lib/velocity/velocity.ui.min.js"></script>

<script src="/hexo/js/utils.js"></script>

<script src="/hexo/js/motion.js"></script>


<script src="/hexo/js/schemes/pisces.js"></script>


<script src="/hexo/js/next-boot.js"></script>




  















  

  

</body>
</html>
